using System.Configuration;

namespace Drill.Configuration.ConfigFile
{
    public abstract class BaseConfigurationSection : ConfigurationSection
    {
        public abstract string SectionGroup { get; }

        public abstract string SectionName { get; }

        public virtual string ConfigSectionName { get { return SectionGroup + "/" + SectionName; } }

		//protected virtual T GetConfigurationAttributeValue<T>(string attributeName, T defaultValue)
		//{
		//	T value = (T)this[attributeName];
		//	return ReferenceEquals(value, default(T)) ? defaultValue : value;
		//}

		//protected virtual T GetConfigurationElement<T>(string key)
		//	where T : ConfigurationElement, new()
		//{
		//	return this[key] as T ?? new T();
		//}

		//protected virtual T GetConfigurationElementCollection<T>(string key)
		//	where T : ConfigurationElementCollection, new()
		//{
		//	return this[key] as T ?? new T();
		//}

        public static string GetConfigSectionName<T>()
            where T : BaseConfigurationSection, new()
        {
            return new T().ConfigSectionName;
        }
    }
}